package com.example.graphicslib.animations;

/**
 * Created by Tatev on 23/3/2014.
 */
public class BaseFrameAnimation implements Framable {

    public BaseFrameAnimation(int maxFrameCount, long duration) {
        this.currentFrame = 0;
        this.maxFrameCount = maxFrameCount;
        this.duration = duration;
    }

    @Override
    public void setFps(int fps) {
        this.fps = fps;
    }

    @Override
    public void onTickResponse(long elapsedTime) {
        currentFrame = (currentFrame == maxFrameCount - 1)? 0: currentFrame + 1;
    }

    @Override
    public void onFinishResponse() {

    }

    @Override
    public long getDuration() {
        return duration;
    }

    @Override
    public int getCurrentFrame() {
        return currentFrame;
    }

    private long duration;
    private int fps;
    private int currentFrame;
    private int maxFrameCount;
}
